import 'package:flutter/material.dart';
import 'package:super_tool_server/common/utils/color_util.dart';

/// 圆角按钮
class GradientButton extends StatelessWidget {
  GradientButton({
    Key? key,
    required this.width,
    required this.height,
    required this.borderRadius,
    required this.text,
    required this.onTap,
    this.fontSize,
    this.fontWeight,
  }) : super(key: key);

  final double width;

  final double height;

  final double borderRadius;

  final String text;

  final GestureTapUpCallback onTap;

  double? fontSize = 12;

  FontWeight? fontWeight = FontWeight.w400;

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      child: Container(
        width: width,
        height: height,
        decoration: BoxDecoration(
          gradient: commonGradient,
          borderRadius: BorderRadius.all(Radius.circular(borderRadius)),
        ),
        child: Center(
          child: Text(
            text,
            textAlign: TextAlign.center,
            style: TextStyle(
                color: Colors.black,
                fontSize: fontSize,
                fontWeight: fontWeight),
          ),
        ),
      ),
      onTapUp: onTap,
    );
  }
}
